Skip to content

VK: Split 05-recruits into four Cardinal Virtue tutorials = - #16

Open
vkurapat wants to merge 6 commits into
PPBDS:mainfrom
vkurapat:dgm-tutorials-rewrite
Open

VK: Split 05-recruits into four Cardinal Virtue tutorials =#16
vkurapat wants to merge 6 commits into
PPBDS:mainfrom
vkurapat:dgm-tutorials-rewrite

Conversation

@vkurapat

@vkurapat vkurapat commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

and incorporate DGM linear content.

vkurapat and others added 6 commits September 7, 2026 23:24
…rate DGM linear content

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAfJeVM4b87jrAjQeQUkZt
…th predictions(datagrid())

plot_predictions() on a parsnip logistic_reg() fit with a continuous
`condition` exhausts memory under marginaleffects 0.32.0, failing the
tutorial render. Exercises 10-11 now sweep MonthlyIncome via an explicit
datagrid() passed to predictions() -- equivalent output, and datagrid()
is already introduced in Exercise 6.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAfJeVM4b87jrAjQeQUkZt
…plot columns resolve

datagrid() with a function-valued grid variable did not carry MonthlyIncome
into the predictions() output on the CI marginaleffects, breaking geom_ribbon()
with "object 'MonthlyIncome' not found". Build the grid as an explicit
tibble()/expand_grid() instead -- predictions(newdata = <df>) always returns
the newdata columns, so the plot code resolves on every marginaleffects version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAfJeVM4b87jrAjQeQUkZt
…tic predictions-12

plot_predictions(mod_logistic, by = "OverTime", type = "prob", draw = FALSE)
crashes under marginaleffects 0.32.0. Exercise 12 now pipes
avg_predictions(by = "OverTime") into ggplot(). With Exercises 10-11 already
switched to predictions(), plot_predictions() is no longer used in the section,
so the covered-functions lists and recap prose are updated to match.
…ctions call

avg_predictions(mod_logistic, by = "OverTime", type = "prob") does not echo
the OverTime column on the CI marginaleffects, breaking aes(x = OverTime) with
"object 'OverTime' not found". Run avg_predictions() on extract_fit_engine()
(the underlying glm) instead: response scale is already P(leaving), no type or
group filtering, and by= reliably returns the OverTime column.
…ine()

predictions()/avg_predictions() on the parsnip logistic_reg() wrapper do not
reliably echo the grid or by= variable as a named column under the CI
marginaleffects, so ggplot(aes(x = MonthlyIncome / OverTime)) fails with
"object not found". Exercises 5, 10, 11, and 12 now call these functions on
extract_fit_engine(mod_logistic) (the underlying glm, type = "response"),
which returns those columns and the probability scale directly -- no type =
"prob" or group filter. Printed chunks (1-4, 6-9) keep the tidymodels wrapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant